package com.marketlive.app.b2c.nav;

/*
(C) Copyright MarketLive. 2006. All rights reserved.
MarketLive is a trademark of MarketLive, Inc.
Warning: This computer program is protected by copyright law and international treaties.
Unauthorized reproduction or distribution of this program, or any portion of it, may result
in severe civil and criminal penalties, and will be prosecuted to the maximum extent
possible under the law.
*/

import org.marketlive.entity.IEntity;
import com.marketlive.app.b2c.NavState;

import java.util.Locale;

/**
 * Interface for generating URLs to entities and paths
 * including encoded NavState information.
 * Also added are overidden methods to generate RSS Feed URLs for categories.
 *
 * @author bcarp
 * @author Anup
 *
 */
public interface ILinkGenerator {

    // Context bean name for link generator implementation.
    //
    public static final String LINK_GENERATOR_BEAN = "linkGenerator";

    // Generation mechanisms: ID, NAME or URL_VALUE
    //
    public static final int URI_BY_ID        = 0;
    public static final int URI_BY_NAME      = 2;
    public static final int URI_BY_URL_VALUE = 3;

    /**
     * Create entity URL based on NavState's current product or
     * category if possible.
     *
     * @param navState
     * @return
     */
    public String defaultEntityRef(NavState navState);

    /**
     * Creates entity reference using specified entity and
     * NavState location.
     *
     * @param entity
     * @param navState
     * @return
     */
    public String entityRef(IEntity entity, NavState navState);


    /**
     * Creates entity reference using specified entity,
     * NavState location and supplemented by optional additonal
     * URL path suffix.
     *
     * @param entity
     * @param additionalPath
     * @param navState
     * @param isRSSRef boolean to specify if requested Ref is for RSS category.
     * @return
     */
    public String entityRefAddPath(IEntity entity, String additionalPath,
                                    NavState navState, boolean isRSSRef);
    
    /**
     * Creates entity reference using specified entity,
     * NavState location and supplemented by optional additonal
     * URL path suffix.
     *
     * @param entity
     * @param additionalPath
     * @param navState
     * @return
     */
    public String entityRefAddPath(IEntity entity, String additionalPath,
                                    NavState navState);

    /**
     * Creates path reference using specified path and
     * NavState's location.
     */
    public String pathRef(String path, NavState navState);


    /** Wraps the given URI.
    *
    * @param uri
    * @param site
    * @param locale
    */
    public String wrapURI(String uri, Locale locale);
}
